Dynomotion

Group: DynoMotion Message: 15265 From: magergar@hotmail.com Date: 12/22/2017
Subject: KMotion_dotNet Exceptions

I'm using visual studio to create a program in C# with Kmotion_dotNet.

My problem is at the moment of handling exceptions, because only occurs once

is there a flag a need to clear?


for example when I send a comand via :

    void SendCommand()

    {

            try
            {
                KM.WriteLine(s);
            }
            catch (DMException) // in case disconnect in the middle of reading status
            {
                MessageBox.Show(ex.InnerException.Message);
            }

    }

and I don't have a kflop connected it show the message

but if I try a second time the message it's not displayed



 

Group: DynoMotion Message: 15266 From: Tom Kerekes Date: 12/22/2017
Subject: Re: KMotion_dotNet Exceptions
I'm not able to duplicate that problem.  What Version of KMotion are you using?

Please provide more specifics on how we might duplicate the problem.

Regards
TK



On 12/22/2017 11:47 AM, magergar@... [DynoMotion] wrote:
 

I'm using visual studio to create a program in C# with Kmotion_dotNet.

My problem is at the moment of handling exceptions, because only occurs once

is there a flag a need to clear?


for example when I send a comand via :

    void SendCommand()

    {

            try
            {
                KM.WriteLine(s);
            }
            catch (DMException) // in case disconnect in the middle of reading status
            {
                MessageBox.Show(ex.InnerException.Message);
            }

    }

and I don't have a kflop connected it show the message

but if I try a second time the message it's not displayed



 


Group: DynoMotion Message: 15267 From: magergar@hotmail.com Date: 12/22/2017
Subject: Re: KMotion_dotNet Exceptions
Attachments :
    I'm usign KMotion 4.33 and visual studio 2015 I also attached the project.

    I created a simple form that only jog the X axis


    if I press one of the buttons without the KFlop Plugged I get an error :



    but if I click the button again this error doesn't show anymore, like the code is not allowed to throw an exception.

    Below it's the code I'm using:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using KMotion_dotNet;

    namespace Error_Test
    {
        public partial class Form1 : Form
        {
            KM_Controller KM = new KM_Controller();
            public Form1()
            {
                InitializeComponent();
               
            }

            private void btn_Xpos_Click(object sender, EventArgs e)
            {
                SendCommand("Jog3=0");
            }

            private void btn_Xneg_Click(object sender, EventArgs e)
            {
                SendCommand("Jog3=0");
            }

            void SendCommand(string s)
            {
                try
                {
                    KM.WriteLine(s);
                }
                catch (DMException ex) // in case disconnect in the middle of reading status
                {
                    MessageBox.Show(ex.InnerException.Message);
                }

            }

            private void btn_Xpos_MouseDown(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=2000");
            }

            private void btn_Xneg_MouseDown(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=-2000");
            }

            private void btn_Xpos_MouseUp(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=0");
            }

            private void btn_Xneg_MouseUp(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=0");
            }
        }
    }
    Group: DynoMotion Message: 15268 From: Tom Kerekes Date: 12/22/2017
    Subject: Re: KMotion_dotNet Exceptions
    Please try Test Version 4.34j.  There have been many changes and fixes since V4.33.  Your program seems to work correctly for me with our latest code.

    Regards
    TK

    On 12/22/2017 2:57 PM, magergar@... [DynoMotion] wrote:
     

    I'm usign KMotion 4.33 and visual studio 2015 I also attached the project.

    I created a simple form that only jog the X axis


    if I press one of the buttons without the KFlop Plugged I get an error :



    but if I click the button again this error doesn't show anymore, like the code is not allowed to throw an exception.

    Below it's the code I'm using:

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using KMotion_dotNet;

    namespace Error_Test
    {
        public partial class Form1 : Form
        {
            KM_Controller KM = new KM_Controller();
            public Form1()
            {
                InitializeComponent();
               
            }

            private void btn_Xpos_Click(object sender, EventArgs e)
            {
                SendCommand("Jog3=0");
            }

            private void btn_Xneg_Click(object sender, EventArgs e)
            {
                SendCommand("Jog3=0");
            }

            void SendCommand(string s)
            {
                try
                {
                    KM.WriteLine(s);
                }
                catch (DMException ex) // in case disconnect in the middle of reading status
                {
                    MessageBox.Show(ex.InnerException.Message);
                }

            }

            private void btn_Xpos_MouseDown(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=2000");
            }

            private void btn_Xneg_MouseDown(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=-2000");
            }

            private void btn_Xpos_MouseUp(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=0");
            }

            private void btn_Xneg_MouseUp(object sender, MouseEventArgs e)
            {
                SendCommand("Jog3=0");
            }
        }
    }